#ifndef CLIENTDATABASEMANAGER_H
#define CLIENTDATABASEMANAGER_H

#include <QObject>
#include <QSqlDatabase>
#include <QJsonObject> // 我们会直接处理 JSON 对象
#include <QList>


class ClientDatabaseManager : public QObject
{
    Q_OBJECT
public:
    static ClientDatabaseManager& instance();

    void saveMessage(const QJsonObject& message);
    QList<QJsonObject> loadChatHistory(int userId1, int userId2);

private:
    explicit ClientDatabaseManager(QObject *parent = nullptr);
    ~ClientDatabaseManager();
    ClientDatabaseManager(const ClientDatabaseManager&) = delete;
    ClientDatabaseManager& operator=(const ClientDatabaseManager&) = delete;

    void initDatabase();
    QSqlDatabase m_db;


signals:
};

#endif // CLIENTDATABASEMANAGER_H
